#include<bits/stdc++.h> 

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    
    vector<string> g(n);
    int tx,ty;
    
    for (int i = 0; i < n; ++i) {
        cin >> g[i];
        for (int j = 0; j < m; ++j) {
            if (g[i][j] == '#') {
                tx = i;
                ty = j;
            }
        }
    }
    
    
    string path1(n-1, 'S');
    path1 += string(m-1, 'D');
    
    bool flag1 = true;
    int x = 0, y = 0;
    for (char c : path1) {
        if (x == tx && y == ty) {
            flag1 = false;
            break;
        }
        if (c == 'S') x++;
        else y++;
    }
    
    if (flag1) {
        cout << path1 << endl;
        return 0;
    }
    
   
    string path2(m-1, 'D');
    path2 += string(n-1, 'S');
    
    bool flag2 = true;
    x = 0, y = 0;
    for (char c : path2) {
        if (x == tx && y == ty) {
            flag2 = false;
            break;
        }
        if (c == 'S') x++;
        else y++;
    }
    
    if (flag2) {
        cout << path2 << endl;
        return 0;
    }
    
    return 0;
}
